package com.projectx.action.contact;

import android.content.Context;
import android.graphics.Bitmap;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.projectx.R;

import java.util.ArrayList;
import java.util.List;

import static com.projectx.action.contact.CreateGroupActivity.recyclerView_horizontal;
import static com.projectx.action.contact.CreateGroupActivity.windowManager;

public class Horizontal_Adapter extends RecyclerView.Adapter<Horizontal_Adapter.VH> {
public class HorizontalAdapter extends RecyclerView.Adapter<HorizontalAdapter.VH> {
    private Context context;
    private List<Bitmap> bitmaps;
    private List<String> data;
    protected static List<Integer> Position=new ArrayList<>();
    public HorizontalAdapter(Context context, List<Bitmap> bitmaps, List<String> data){
        this.context=context;
        this.data=data;
        this.bitmaps=bitmaps;
        Log.d("lzw","recycleview呢");
    }
    public VH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(context).inflate(R.layout.creategroup_item_h, parent, false);
        return new VH(view);
    }
    public void onBindViewHolder(VH holder, int position){
       // holder.textView.setText("测试"+position);
        holder.imageView.setImageBitmap(bitmaps.get(Position.get(position)));
        //holder.imageView.setImageResource(R.drawable.ic_account_circle_black_36dp);
    }
    public int getItemCount(){
        return Position.size();
    }
    public static class VH extends RecyclerView.ViewHolder{
        ImageView imageView;
        TextView textView;
        public VH(@NonNull View itemView){
            super(itemView);
            imageView=itemView.findViewById(R.id.imageView);
            textView=itemView.findViewById(R.id.text);
        }
    }
}
